package com.example.mcpweather;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@CrossOrigin(origins = "http://localhost:3000") // 允许来自3000端口的跨域请求
public class    test {


    // 原有的PostMapping方法保持不变
///http://localhost:8013/busiplatform/com.asiainfo.uspa.action.login.loginAction?action=loginBySwitch

    // 新增的测试方法，用于处理loginBySwitch请求
    @RequestMapping(value = "/busiplatform/com.asiainfo.uspa.action.login.loginAction", method = {RequestMethod.GET, RequestMethod.POST})
    public String loginBySwitch(@RequestParam("action") String action){
        log.info("Received request with action parameter: {}", action);
        log.info("Processing loginBySwitch request");

        if ("loginBySwitch".equals(action)) {
            log.info("Executing loginBySwitch logic");
            return "login success";
        } else {
            log.warn("Unknown action: {}", action);
            return "unknown action";
        }
    }


    // 原有的test方法保持不变
    @GetMapping("/test")
    public String ax(){
        log.info("test");
        return "success";
    }
}

